/**
 * model层
 * 负责接受服务器消息
 * 负责处理服务器发来的原始数据
 * 将服务器数据保存到@Mutable修饰的变量中
 */

import DownloadJson from "../../../framework/base/DownloadJson";
import AbstractModel from "../../../framework/base/mvvm/AbstractModel";

export default class launch_model extends AbstractModel {

    
    protected loaded() {
        
    }
    protected unload() {
        
    }
    public async initData():Promise<cc.JsonAsset>{
        const dataJson = new DownloadJson();
        let jsonData: any = await dataJson.getData();
        let nJsonData: any = await dataJson.load_N_Data();
        if (this.judgeVersion(jsonData.version, nJsonData.version)) {
            jsonData =  nJsonData;
        }
        return jsonData;
    }
    public judgeVersion(remote: string, native: string): boolean{
        if(remote !== native){
            return true;
        }
        return false;
    }

    logData() {
        // let myBundle = new cc.AssetManager.Bundle();
        // myBundle.init({base: 'assets/lobby/',importBase: 'import',name: 'lobby'});
        
        // myBundle.name = 'lobby';
        // myBundle.base = 'assets';
        // console.log('logData',myBundle, cc.assetManager.resources,cc.assetManager.assets);
    }
}